package com.ayoka.adapter;

import android.widget.ImageView;

import com.ayoka.R;
import com.ayoka.mvp.CourseAssignmentAppreciateMVP.CourseAssignmentAppreciateModel.ChildPhotoBean;
import com.jcp.baselibrary.brvah.BaseQuickAdapter;
import com.jcp.baselibrary.brvah.BaseViewHolder;
import com.jincp.image.load.ImageLoaderOptions;
import com.jincp.image.load.ImageLoaderProxy;

import java.util.List;

/**
 * Created by jinchunping on 2018/4/11.
 */

public class UserPictureAdapter extends BaseQuickAdapter<ChildPhotoBean, BaseViewHolder> {

    public UserPictureAdapter(List<ChildPhotoBean> data) {
        super(R.layout.item_user_picture, data);
    }

    @Override
    protected void convert(final BaseViewHolder holder, final ChildPhotoBean item) {
        if (item == null){
            ImageLoaderProxy.getInstance().displayImage(R.mipmap.icon_add_picture, (ImageView) holder.getView(R.id.iv_picture));
        } else {
            ImageLoaderProxy.getInstance().displayImage(item.ImgUrl, (ImageView) holder.getView(R.id.iv_picture), ImageLoaderOptions.getRoundOptions());
        }
    }
}
